project('gstreamer-example', 'c')

cc = meson.get_compiler('c')

cJSON = dependency('libcjson', required: false)

if not cJSON.found()
    cJSON = dependency('cJSON', required: false)
endif

if not cJSON.found() 
    cJSON = cc.find_library('cjson', has_headers: ['cjson/cJSON.h'], required: true)
endif

deepstream = cc.find_library(
    'nvdsgst_meta', 
    dirs: ['/opt/nvidia/deepstream/deepstream/lib'],
    has_headers: ['/opt/nvidia/deepstream/deepstream/sources/includes/gstnvdsmeta.h'], 
    required: true
)

ds_include = include_directories('/opt/nvidia/deepstream/deepstream/sources/includes')

glib = dependency('glib-2.0')

gstdep = dependency('gstreamer-1.0') 
# cJSON = dependency('libcjson')

classid = library('classid', 'classid.c', dependencies: [cJSON])

src = ['main.c', 'meta_utils.c']
executable('demo', src, 
    dependencies : [gstdep, glib, deepstream],
    include_directories: ds_include,
    link_with: classid
)



